import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import request from 'utils/request';
import { CPAAS_PLATFORM } from 'utils/config';
/**
 * 查询集团信息
 * @param {Object} params - 查询参数
 * @param {String} params.organizationId - 组织ID
 */

export function fetchGroup(_x) {
  return _fetchGroup.apply(this, arguments);
}
/**
 * 更新集团信息
 * @param {Object} params - 查询参数
 * @param {String} params.organizationId - 组织ID
 */

function _fetchGroup() {
  _fetchGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            return _context.abrupt("return", request("".concat(CPAAS_PLATFORM, "/v1/").concat(params.organizationId, "/groups/self"), {
              method: 'GET'
            }));

          case 1:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _fetchGroup.apply(this, arguments);
}

export function updateGroup(_x2) {
  return _updateGroup.apply(this, arguments);
}

function _updateGroup() {
  _updateGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(params) {
    return _regeneratorRuntime.wrap(function _callee2$(_context2) {
      while (1) {
        switch (_context2.prev = _context2.next) {
          case 0:
            return _context2.abrupt("return", request("".concat(CPAAS_PLATFORM, "/v1/").concat(params.organizationId, "/groups"), {
              method: 'POST',
              body: params
            }));

          case 1:
          case "end":
            return _context2.stop();
        }
      }
    }, _callee2);
  }));
  return _updateGroup.apply(this, arguments);
}